package com.zjw.zy.utils;

import android.os.Handler;
import android.os.Looper;

import com.zjw.zy.R;
import com.zjw.zy.utils.taskpool.BackGroundExecutor;


/**
 * @author ：zhong.jw
 * @date ：Created in 2022/9/26 16:58
 */
public final class BackHelper {

    public static Handler mHandler = BackGroundExecutor.get().getBackHandler();

    public static final int BACK_TASK_TIME_DELAY_MSG = "BACK_TASK_TIME_DELAY_MSG".hashCode();
    public static final long BACK_TASK_TIME_DELAY = 3000L;


    public static boolean canExit() {
        return mHandler.hasMessages(BACK_TASK_TIME_DELAY_MSG);
    }

    public static void markBackPressed() {
        mHandler.sendEmptyMessageDelayed(BACK_TASK_TIME_DELAY_MSG, BACK_TASK_TIME_DELAY);
        ToastUtils.showLong(ResourcesUtils.getString(R.string.long_press_exit_application_text));
    }
}
